package net.lanelife.casino.caipiao.dto.admin;

import java.util.List;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Selection;

import net.lanelife.casino.caipiao.entity.UserLayer;
import net.lanelife.casino.caipiao.entity.UserLayer_;
import net.lanelife.casino.common.dto.support.GenericTable;

import com.google.common.collect.Lists;

/**
 * @author Lane
 * 
 * 用户分层表格
 *
 * @param <DTO>
 */
public class UserLayerTable<DTO> extends GenericTable<DTO, UserLayer> {

	private static final long serialVersionUID = 4099211520762947599L;
	
	private Long layerUsers;
	
	public UserLayerTable() {}
	
	public UserLayerTable(Long layerUsers) {
		super();
		this.layerUsers = layerUsers;
	}

	@Override
	public List<Selection<?>> buildExpression(Root<UserLayer> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
		List<Selection<?>> columns = Lists.newArrayList();
		columns.add(builder.sum(root.get(UserLayer_.layerUsers)));
		return columns;
	}

	public Long getLayerUsers() {
		return layerUsers;
	}

	public void setLayerUsers(Long layerUsers) {
		this.layerUsers = layerUsers;
	}


}
